<%--
  Created by IntelliJ IDEA.
  User: lenovo
  Date: 2017/5/22
  Time: 9:03
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <jsp:include page="../../head.jsp"/>
    <title>申报口岸维护</title>
    <script type="text/javascript">
        var formSetting = {
            title: "查询信息",
            module: 'query',
            columns: [
                {
                    index:"PORT_CODE",
                    name: "portCode",
                    label: "口岸编码"
                }, {
                    index:"PORT_NAME",
                    name: "portName",
                    label: "口岸名称"
                }, {
                    index:"PORT_INITIALS",
                    name: "portInitials",
                    label: "名称首字母"
                }, {
                    index:"HAS_SO",
                    name: "hasSO",
                    label: "是否必须SO号",
                    type: "dropdown",
                    data: [["需要", "0"], ["不需要", "1"]],
                    op: "eq",
                    minLength: 0
                }
               ],
            buttons: {
                custom: [
                    {
                        id: "addBtn",
                        value: "添加口岸",
                        click: function(){
                            location.replace('detail');
                        }
                    }, {
                        id: "editBtn",
                        value: "修改口岸",
                        click: function(){
                            var selectedRowId = $("#declarationPortDataGrid").getGridParam("selrow");
                            if (selectedRowId) {
                                var selectedRow = $("#declarationPortDataGrid").getRowData(selectedRowId);
                                location.href ="detail?id="+ selectedRow.id;
                            } else {
                                alert("请选择需要修改的记录!")
                            }
                        }
                    }]
            },
            grid: {
                id: "declarationPortDataGrid",
                title: "查询结果",
                url: "findList",
                multiselect: true,
                colModel: [{
                    index: "ID",
                    name: "id",
                    hidden: true
                }, {
                    name: "portCode",
                    label: "口岸编码"
                }, {
                    name: "portName",
                    label: "口岸名称"
                }, {
                    name: "portInitials",
                    label: "名称首字母"
                }, {
                    name: "portSort",
                    label: "排序"
                }, {
                    name: "hasSO",
                    label: "是否必须SO号",
                    formatter : function(cellvalue, options, rowObject) {
                        if (cellvalue == "0") {
                            return "需要";
                        } else {
                            return "不需要";
                        }
                    }
                }],
                sortname: "portSort",
                sortorder: "asc"
            }
        };
        $(document).ready(function () {
            $("#declarationPortDataTable").mrdForm(formSetting);
        });
    </script>
</head>
<body>
<div id="declarationPortDataTable"></div>
</body>
</html>
